<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h1>计算器</h1>
		<input type="text"id="num1"/>
		<select id="set">
			<option value="0">+</option>
			<option value='1'>-</option>
			<option value="2">*</option>
			<option value="3">/</option>
		</select>
		<input type="text"id="num2"/>
		=
		<input type="text"id="num3" value=""/>
		<button type="button" onclick="tj()">提交</button>
		<button type="button" onclick="sx()">重置</button>
	</body>
	<script type="text/javascript">
		function tj(){
			var shu1=document.getElementById('num1').value;
			var shu2=document.getElementById('num2').value;
			var obj = document.getElementById('set').value;
			var jg=0;
			switch (obj){
				case '0':
			jg=(parseFloat(shu1)+parseFloat(shu2));
					break;
				case '1':
		    jg=(parseFloat(shu1)-parseFloat(shu2));
					break;
				case '2':
			jg=(parseFloat(shu1)*parseFloat(shu2));
					break;
				case '3':
			jg=(parseFloat(shu1)/parseFloat(shu2));
					break;
			}
			num3.value=jg;
		}
		function sx(){
			location.reload();
		}
	</script>
</html>
